package com.java.common.validate;


import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * 自定义验证规则--注解
 *
 * message、groups、payload是自定义规则需遵守的，value自定义
 *
 * message在ValidationMessages.properties内
 * 规则在ListValueConstraintValidator.class内
 */
@Documented
@Constraint(validatedBy = { ListValueConstraintValidator.class }) //指定规则
@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE })
@Retention(RUNTIME)
public @interface ListValue {
    String message() default "{com.java.common.validate.ListValue.message}";

    Class<?>[] groups() default { };

    Class<? extends Payload>[] payload() default { };

    int[] value() default {};
}
